package com.haiya.state.studycase;

public abstract class AbstractState {
    protected ScoreContext context;

    /**
     * 成绩名称:
     * - 不及格
     * - 中等
     * - 优秀
     */
    protected String stateName;

    /**
     * 学生分数
     */
    protected int score;

    public void addScore(int score) {
        this.score += score;
        System.out.print("加上：" + score + "分，\t当前分数：" + this.score);
        checkState();
        System.out.println("分，\t当前状态：" + context.getState().stateName);
    }

    /**
     * 检查学生当前成绩状态
     */
    public abstract void checkState();
}
